import Vue from 'vue';
import axios from 'axios';

// 请求配置信息
async function getServerConfig() {
  const protocolTmp = window.location.protocol; // 获取当前 URL 的协议
  const { host } = window.location; // 获取当前host
 return new Promise(async (resolve, reject) => {
  await axios.get(`${protocolTmp}//${host}/baseConfig.json`).then((result) => {
   const base_host = result.data.base_host;
   //把配置挂载在Vue属性上，以便调用
   console.log(base_host,333)
   Vue.prototype.$base_host = base_host;
   resolve();
  }).catch((error) => {
   console.log('error', error);
   reject();
  });
 });
}
getServerConfig();
